#!/bin/bash -x

wget "http://172.28.114.53:8088/jdk-8u311-linux-x64.tar.gz" -O /home/jdk-8u311-linux-x64.tar.gz
tar -zxvf /home/jdk-8u311-linux-x64.tar.gz -C /usr/local

JAVA_HOME=/usr/local/jdk1.8.0_311
ETC_FILE=/etc/profile

{
  echo "export JAVA_HOME=${JAVA_HOME}"
  echo "export CLASSPATH=.:\${JAVA_HOME}/lib"
  echo "export PATH=\${JAVA_HOME}/bin:\$PATH"
} >> $ETC_FILE

source /etc/profile